var express = require('express')
const router = express.Router()
const path = require('path')
const fs = require('fs')
const util = require('../util/util')

router.use(function(req, res, next){
    next()
})
var searchGoodsObj = {
    goodsId: '1',
    skuId: '1',
    goodsName: '商品名称',
    goodsStock: '30000',
    goodsType: '1',
    goodsCurrentPrice: '90',
    goodsOriginPrice: '100',
    goodsMinimumPrice: '80'
}

// 查询推荐商品
router.post('/searchGoods', function(req, res){
    var file = path.join(__dirname, '../', '/JSON/banner.json'); //文件路径，__dirname为当前运行js文件的目录
	res.send({
        code: 200,
        data: {
            "count": 651,
            list: util.createListIndex(searchGoodsObj)
        }
    });
})
// 提交推荐商品信息
router.post('/submitSellGoods', function(req, res){
    res.send({
        code: 200,
        data: null
    })
})
// 发送推荐商品短信
router.post('/sendSellGoodsSms', function(req, res){
    res.send({
        code: 200,
        data: null,
        msg: '发送成功'
    })
})
// 删除推荐商品
router.post('/delSellGoods', function(req, res){
    res.send({
        code: 200,
        data: null,
        msg: '发送成功'
    })
})
// 商品订单改价接口
router.post('/changeSellGoodsPrice', function(req, res){
    res.send({
        code: 200,
        data: null,
        msg: '改价成功'
    })
})
// 查询已推荐商品信息接口
router.post('/querySellGoodsDetail', function(req, res){
    res.send({
        code: 200,
        data: {
            callTaskRecordId: util.mandomNum(),
            goodsId: '1',
            goodsName: '125项青中老年全身综合体检套餐',
            goodsType: 1,
            goodsSendTime: '2020/05/22 09:37:50',
            goodsOriginPrice: '100',
            goodsCurrentPrice: '10',
            goodsMinimumPrice: '90',
            goodsPayablePrice: '90',
            goodsPayPrice: '85',
            orderNo: util.mandomNum(),
            goodsOrderTime: '2020/05/22 09:37:50',
            goodsBuyCount: 20,
            goodsPayTime: '2020/05/22 09:37:50',
            sellGoodsStatus: 'SELL_GOODS_INIT',
            sellGoodsUv: 22,
            sendSellGoodsContent: '【优健康】尊敬的张强强您好，为您推荐【热销爆款】125项青中老年全身综合体检套餐，点击下方链接进行购买t.cn/S2xt2g 退订回T'
        },
        msg: '改价成功'
    })
})

// 05、查询推荐商品详情接口
router.post('/queryGoodsDetail', function(req, res){
    res.send({
        code: 200,
        data: {
            
        },
        msg: '改价成功'
    })
})

module.exports = router